#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Create by zhang
# Create on 2022/7/26 20:29
from infrastructure.constant.response_constant import ResponseConstant


class ResponseWrapper:
    def __init__(self, code:int, msg:str=None, data:object=None):
        self.code = code
        self.msg = msg
        self.data = data

    @classmethod
    def success(cls, msg:str=None, data:object=None):
        return ResponseWrapper(code=ResponseConstant.SUCCESS, msg=msg, data=data)

    @classmethod
    def fail(cls, msg: str = None, data: object = None):
        return ResponseWrapper(code=ResponseConstant.FAIL, msg=msg, data=data)
